package com.lemo.service;

import com.lemo.bean.User;
import com.lemo.dao.UserDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.io.Serializable;

@Service
@Transactional
public class UserServiceImpl implements UserService {

    @Autowired
    UserDao userDao;

    @Override
    public User get(Long id) {
        return userDao.getOne(id);
    }

    @Override
    public boolean update(User record) throws Exception {
        return userDao.saveAndFlush(record) != null;
    }

    @Override
    public boolean add(User record) throws Exception {
        return userDao.save(record) != null;
    }

    @Override
    public void del(Long id) {
        userDao.delete(id);
    }
}
